<template>
    <el-dialog class="eldialog" :visible.sync="visible" :title="title" :close-on-click-modal="false" append-to-body
        top="2vh" width="98%" :close-on-press-escape="false" :before-close="handleClose">
        <div class="topTable">
            <vxe-table ref="mytable" :height="heightY" :data="articlesData" style="width: 100%; margin-bottom: 10px" border
                stripe highlight-current-row v-loading="loading" :resizable="true"
                >
                <vxe-column type="checkbox" width="60"  align="center"></vxe-column>
                <vxe-column field="xingming"  title="姓名" width="90" align="center" sortable />
                <vxe-column field="xingbie" title="性别" align="center" width="60">
                </vxe-column>

                <vxe-column field="minzu_mc" title="民族" align="center" width="80" />
                <vxe-column field="zhiwu_jiancheng" title="工作单位及职务" align="center" width="240" />
                <vxe-column field="csny" title="出生年月" width="120" align="center" />
                <vxe-column field="rudangxinxi" title="入党时间" align="center" width="180" />

                <vxe-column field="qrzxl_zg" title="全日制学历" width="160" align="center" />
                <vxe-column field="qrzxlxx_zg" title="毕业院校" width="160" align="center" />
                <vxe-column field="qrzxw_zg" title="全日制学位" width="160" align="center" />
                <vxe-column field="qrzxwxx_zg" title="专业" width="160" align="center" />
                <vxe-column field="zzxl_zg" title="在职学历" width="160" align="center" />
                <vxe-column field="zzxlxx_zg" title="毕业院校" width="160" align="center" />
                <vxe-column field="zzxw_zg" title="在职学位" width="160" align="center" />
                <vxe-column field="zzxwxx_zg" title="专业" width="160" align="center" />

                <vxe-column field="cjgzsj" title="参加工作时间" width="140" align="center" />
                <vxe-column field="zw_sj" title="任现职时间" width="120" align="center" />
                <vxe-column field="zjcc_sj" align="center" title="任现职级时间" width="140" />
            </vxe-table>
        </div>
        <rmb-add v-if="showRMB" ref="rmb" @cardreTypeList="init" />
        <div />
    </el-dialog>
</template>
  
<script>
import rmb from "@/views/young/datacollect/rmbInfo/rmb";
import { exportExeclForPerson } from "@/api/young/echarts/cadre/cadre";
import {saveList,selectList,deleteList,getPersonOneList,getSzWarningLevelPersonList,
    getPersonTwoList,getPersonList,getPersonTwelveList, getOrganizationForCountyAndTown,getPersonForCityDz,getRemindPerson,getSzbzpbyjPersonList,getCityOfDzLeadingGroupWarningLevelPersonList,getTwelvPersonGroup} from '@/api/young/echarts/cadre/cadreNew'
  import {getPersonByIds,getDZPersonByIds,getCountyPersonByIds,getPersonByIdSG} from '@/api/young/echarts/cadre/cadre'
  import store from  "@/store";
export default {
    name: "detailList",
    components: {
        "rmb-add": rmb,
        // essential: essential,
    },
    data() {
        // eslint-disable-next-line no-return-assign
        return {
            title:"",
            visible: true,
            showPersonOut: false,
            showRMB: false,
            alertPar: "", // 类型
            loading: false,
            cardreList: [],
            articlesData: [],
            articlesDataTwo:[],
            // 分页
            searchKeys: ["getintoId", "roleName"],
            totalItems: 0,
            currentPage: 1,
            perPage: 100,
            heightY: window.innerHeight - 220 + "px",
            itemList: [], // 权限字段
            paramsList: [], // 条件
            alertPar: "", // 标题
            downloadAllData: [], // 下载全部的数据
            essentialDialog: false, //穿梭框的开关
            paramData: [],
            alertParList: "",
        };
    },
    methods: {
        async init(param,alertPar) {
            console.log(alertPar,"alertPar");
            let resultString = alertPar.split("--")[1]
            this.title = resultString;
            var that = this
            that.totalItems=0
            that.articlesData=[],
            that.loading = true
          if(that.visible == false){
              that.currentPage = 1
          }
          that.visible = true
          that.paramsList = param
          that.alertPar = alertPar
          if(param.all != 'true') {
              param['page'] = that.currentPage   // 页号
              param['rows'] = that.perPage   // 条数
  
          }else {
              delete param.page
              delete param.rows
          }
         // if(typeof(param) == undefined){}
          // 查询后台接口 获取人员列表进行分页
          if(that.paramsList.showType == 'one'){
              await getPersonOneList(param).then(function(result) { // 获取单位反查列表数据
                  // eslint-disable-next-line no-empty
                  that.$nextTick(() => {
                      if (result.result) {
                          if(param.all != 'true') {
                              that.totalItems = result.resultdata.count
                              that.articlesData = result.resultdata.data
                          }else {
                              //that.downloadAllData = result.resultdata.data
                              const params = {
                                  'personList': result.resultdata.data,
                                  'fileName': that.alertPar + ' - 人员统计表.xlsx'
                              }
                               exportExeclForPerson(params).then(function (result) {
                              })
                          }
                      }
                      that.loading = false
                  })
              })
          }else if(that.paramsList.showType == 'two'){
              await getPersonTwoList(param).then(function(result) { // 获取单位反查列表数据
                  // eslint-disable-next-line no-empty
                  that.$nextTick(() => {
                      if (result.result) {
                          if(param.all != 'true') {
                              that.totalItems = result.resultdata.count
                              that.articlesData = result.resultdata.data
                          }else {
                              const params = {
                                  'personList': result.resultdata.data,
                                  'fileName': that.alertPar + ' - 人员统计表.xlsx'
                              }
                              exportExeclForPerson(params).then(function (result) {
                              })
                          }
                      }
                      that.loading = false
                  })
              })
          }else if (that.paramsList.showType == 'twoTwo'){
              await getPersonTwoList(param).then(function(result) { // 获取单位反查列表数据
                  // eslint-disable-next-line no-empty
                  that.showTypeList = true
                  that.$nextTick(() => {
                      if (result.result) {
                          if(param.all != 'true') {
                              that.totalItems = result.resultdata.count
                              that.articlesData = result.resultdata.data
                          }else {
                              const params = {
                                  'personList': result.resultdata.data,
                                  'fileName': that.alertPar + ' - 人员统计表.xlsx'
                              }
                              exportExeclForPerson(params).then(function (result) {
                              })
                          }
                      }
                      that.loading = false
                  })
              })
          }else if (that.paramsList.showType == 'three'){
              await getPersonList(param).then(function(result) { // 获取单位反查列表数据
                  // eslint-disable-next-line no-empty
                  that.showTypeList = true
                  that.$nextTick(() => {
                      if (result.result) {
                          if(param.all != 'true') {
                              that.totalItems = result.resultdata.count
                              that.articlesData = result.resultdata.data
                          }else {
                              const params = {
                                  'personList': result.resultdata.data,
                                  'fileName': that.alertPar + ' - 人员统计表.xlsx'
                              }
                              exportExeclForPerson(params).then(function (result) {
                              })
                          }
                      }
                      that.loading = false
                  })
              })
          }else if(that.paramsList.showType == 'twelve'){
              await getPersonTwelveList(param).then(function(result) { // 获取单位反查列表数据
                  // eslint-disable-next-line no-empty
                  that.showTypeList = true
                  that.$nextTick(() => {
                      if (result.result) {
                          if(param.all != 'true') {
                              that.totalItems = result.resultdata.count
                              that.articlesData = result.resultdata.data
                          }else {
                              const params = {
                                  'personList': result.resultdata.data,
                                  'fileName': that.alertPar + ' - 人员统计表.xlsx'
                              }
                              //
                              exportExeclForPerson(params).then(function (result) {
                              })
                          }
                      }
                      that.loading = false
                  })
              })
          }else if (that.paramsList.showType == 'fifteen'){//getPersonFifteenList
              await getTwelvPersonGroup(param).then(function(result) { // 获取单位反查列表数据
                  // eslint-disable-next-line no-empty
                  that.showTypeList = true
                  that.$nextTick(() => {
                      if (result.result) {
                          if(param.all != 'true') {
                              that.totalItems = result.resultdata.count
                              that.articlesData = result.resultdata.data
                          }else {
                              const params = {
                                  'personList': result.resultdata.data,
                                  'fileName': that.alertPar + ' - 人员统计表.xlsx'
                              }
                              exportExeclForPerson(params).then(function (result) {
                              })
                          }
                      }
                      that.loading = false
                  })
                  })
          }else if(that.paramsList.showType =='seven'||that.paramsList.showType =='eight'||that.paramsList.showType =='ten'
              ||that.paramsList.showType =='eleven'||that.paramsList.showType =='thirteen'
              ||that.paramsList.showType =='fourteen'){
              if(param.all != 'true') {
                  that.paramsList.data['page'] = that.currentPage   // 页号
                  that.paramsList.data['rows'] = that.perPage   // 条数
              }else {
                  delete that.paramsList.data.page
                  delete that.paramsList.data.rows
              }
              await getPersonByIds(that.paramsList).then(function(result) { // 获取单位反查列表数据
                  // eslint-disable-next-line no-empty
                  that.$nextTick(() => {
                      if (result.result) {
                          if(param.all != 'true') {
                              that.totalItems = result.resultdata.count
                              that.articlesData = result.resultdata.data
                          }else {
                              const params = {
                                  'personList': result.resultdata.data,
                                  'fileName': that.alertPar + ' - 人员统计表.xlsx'
                              }
                              exportExeclForPerson(params).then(function (result) {
                              })
                          }
                      }
                      that.loading = false
                  })
              })
          }else if(that.paramsList.showType =='four'||that.paramsList.showType =='five'
              ||that.paramsList.showType =='six'
              ){
              if(param.all != 'true') {
                  that.paramsList.data['page'] = that.currentPage   // 页号
                  that.paramsList.data['rows'] = that.perPage   // 条数
              }else {
                  delete that.paramsList.data.page
                  delete that.paramsList.data.rows
              }
              await getPersonByIdSG(that.paramsList).then(function(result) { // 获取单位反查列表数据
                  // eslint-disable-next-line no-empty
                  that.$nextTick(() => {
                      if (result.result) {
                          if(param.all != 'true') {
                              that.totalItems = result.resultdata.count
                              that.articlesData = result.resultdata.data
                          }else {
                              const params = {
                                  'personList': result.resultdata.data,
                                  'fileName': that.alertPar + ' - 人员统计表.xlsx'
                              }
                              exportExeclForPerson(params).then(function (result) {
                              })
                          }
                      }
                      that.loading = false
                  })
              })
          }else if(that.paramsList.showType =='eightDZ'||that.paramsList.showType =='fourteenDZ'){
              if(param.all != 'true') {
                  that.paramsList.data['page'] = that.currentPage   // 页号
                  that.paramsList.data['rows'] = that.perPage   // 条数
              }else {
                  delete that.paramsList.data.page
                  delete that.paramsList.data.rows
              }
              await getDZPersonByIds(param).then(function(result) { // 获取单位反查列表数据
                  // eslint-disable-next-line no-empty
                  that.$nextTick(() => {
                      if (result.result) {
                          if(param.all != 'true') {
                              that.totalItems = result.resultdata.count
                              that.articlesData = result.resultdata.data
                          }else {
                              const params = {
                                  'personList': result.resultdata.data,
                                  'fileName': that.alertPar + ' - 人员统计表.xlsx'
                              }
                              exportExeclForPerson(params).then(function (result) {
                              })
                          }
                      }
                      that.loading = false
                  })
              })
          }else if(that.paramsList.showType =='tenCounty'){
              if(param.all != 'true') {
                  that.paramsList.data['page'] = that.currentPage   // 页号
                  that.paramsList.data['rows'] = that.perPage   // 条数
              }else {
                  delete that.paramsList.data.page
                  delete that.paramsList.data.rows
              }
              await getCountyPersonByIds(param).then(function(result) { // 获取单位反查列表数据
                  that.$nextTick(() => {
                      if (result.result) {
                          if(param.all != 'true') {
                              that.totalItems = result.resultdata.count
                              that.articlesData = result.resultdata.data
                          }else {
                              const params = {
                                  'personList': result.resultdata.data,
                                  'fileName': that.alertPar + ' - 人员统计表.xlsx'
                              }
                              exportExeclForPerson(params).then(function (result) {
                              })
                          }
                      }
                      that.loading = false
                  })
              })
          }else if(that.paramsList.showType =='nineCountyAndTown'){
              if(param.all != 'true') {
                  that.paramsList.data['page'] = that.currentPage   // 页号
                  that.paramsList.data['rows'] = that.perPage   // 条数
              }else {
                  delete that.paramsList.data.page
                  delete that.paramsList.data.rows
              }
              await getOrganizationForCountyAndTown(param).then(function(result) { // 获取单位反查列表数据
                  // eslint-disable-next-line no-empty
                  that.$nextTick(() => {
                      if (result.result) {
                          if(param.all != 'true') {
                              that.totalItems = result.resultdata.count
                              that.articlesData = result.resultdata.data
                          }else {
                              const params = {
                                  'personList': result.resultdata.data,
                                  'fileName': that.alertPar + ' - 人员统计表.xlsx'
                              }
                              exportExeclForPerson(params).then(function (result) {
                              })
                          }
                      }
                  })
                  that.loading = false
              })
          }else if(that.paramsList.showType =='nineCityDz'){
              if(param.all != 'true') {
                  that.paramsList.data['page'] = that.currentPage   // 页号
                  that.paramsList.data['rows'] = that.perPage   // 条数
              }else {
                  delete that.paramsList.data.page
                  delete that.paramsList.data.rows
              }
              await getPersonForCityDz(param).then(function(result) { // 获取单位反查列表数据
                  // eslint-disable-next-line no-empty
                  that.$nextTick(() => {
                      if (result.result) {
                          if(param.all != 'true') {
                              that.totalItems = result.resultdata.count
                              that.articlesData = result.resultdata.data
                          }else {
                              const params = {
                                  'personList': result.resultdata.data,
                                  'fileName': that.alertPar + ' - 人员统计表.xlsx'
                              }
                              exportExeclForPerson(params).then(function (result) {
                              })
                          }
  
                      }
                      that.loading = false
                  })
  
              })
  
          }else if(that.paramsList.showType =='rxcb'){
              getRemindPerson(param).then(function(result) {
                  if (result.result) {
                      if(param.all != 'true') {
                          that.totalItems = result.resultdata.count
                          that.articlesData = result.resultdata.data
                      }else {
                          const params = {
                              'personList': result.resultdata.data,
                              'fileName': that.alertPar + ' - 人员统计表.xlsx'
                          }
                          exportExeclForPerson(params).then(function (result) {
                          })
                      }
                  }
                  that.loading = false
              })
  
  
          }else if(that.paramsList.showType =='getSzWarningLevelPersonList'){
              that.loading = true
              getSzWarningLevelPersonList(param).then(function(result) {
                console.log(result,"详情")
                  if (result.result) {
                      if(param.all != 'true') {
                          that.totalItems = result.resultdata.count
                          that.articlesData = result.resultdata.data
                      }else {
                          const params = {
                              'personList': result.resultdata.data,
                              'fileName': that.alertPar + ' - 人员统计表.xlsx'
                          }
                          exportExeclForPerson(params).then(function (result) {
                          })
                      }
                  }
                  that.loading = false
              })
  
          }else if(that.paramsList.showType =='getCityOfDzLeadingGroupWarningLevelPersonList'){
              that.loading = true
              getCityOfDzLeadingGroupWarningLevelPersonList(param).then(function(result) {
                  if (result.result) {
                      if(param.all != 'true') {
                          that.totalItems = result.resultdata.count
                          that.articlesData = result.resultdata.data
                      }else {
                          const params = {
                              'personList': result.resultdata.data,
                              'fileName': that.alertPar + ' - 人员统计表.xlsx'
                          }
                          exportExeclForPerson(params).then(function (result) {
                          })
                      }
  
                  }
                  that.loading = false
              });
  
          }
  
        this.$nextTick(() => {
            this.$refs.mytable.recalculate()
        })
        },
        handleClose(){
            this.visible = false;
        }
    },
};
</script>
  
<style scoped>
.customRoot-icon {
    width: 20px;
    height: 16px;
    display: inline-block;
    /* background: url("../../../assets/images/young/customRoot.png"); */
}

.customParent-icon {
    width: 20px;
    height: 20px;
    display: inline-block;
    /* background: url("../../../assets/images/young/customParent.png"); */
}

.customChildren-icon {
    width: 20px;
    height: 18px;
    display: inline-block;
    /* background: url("../../../assets/images/young/customChildren.png"); */
}

.button {
    display: flex;
    justify-content: flex-end;
}
</style>
  